package cn.jiyun.controller;

import cn.jiyun.entity.*;
import cn.jiyun.service.ContestFeignService;
import cn.jiyun.service.ContestService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author weiyuanhang
 *  * @data: 2023/8/28 002811:54
 *  * @Package cn.jiyun.controller
 * @email 3185757326@qq.com
 */
@RestController
@RequestMapping("/mycontest")
public class ContestController {
    @Autowired
    private ContestService contestService;
    @Autowired
    private ContestFeignService contestFeignService;
    @PostMapping("/findContest")
    public PageInfo<ContestVO> findContest(@RequestBody ContestDTO contestDTO){
        return contestFeignService.findAll(contestDTO);
    }
    @GetMapping("/findContestList")
    public List<Contest> findContestList(){
        return contestService.list();
    }
    @GetMapping("/findCDate")
    public Result findCDate(){
        return contestFeignService.findContestDate();
    }
    @GetMapping("/findByTypo")
    public List<Typo> findByTypo(){
        return contestFeignService.findTypo();
    }
    @PostMapping("/savecontest")
    public Result savecontest(@RequestBody Contest contest){
        return Result.ok(contestService.savecontest(contest));
    }
}
